<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>LCPress - 创作中心</title>
<link rel="stylesheet" href="/static/layui/css/layui.css">
<link rel="stylesheet" href="/static/admin/css/main.css">
<script src="/static/layui/layui.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">
		<div class="layui-header">
			<div class="layui-logo">LCPress创作中心</div>
			<!-- 头部区域（可配合layui已有的水平导航） -->
			<ul class="layui-nav layui-layout-left">
				
			</ul>
			<ul class="layui-nav layui-layout-right">
				<li class="layui-nav-item">
				<a href="javascript:;"> 
					<img src="http://t.cn/RCzsdCq" class="layui-nav-img"> 
					<span id="username">__</span>
				</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="">基本资料</a>
						</dd>
						<dd>
							<a href="">安全设置</a>
						</dd>
						<dd>
							<a href="/adminuserop/logout">退出</a>
						</dd>
					</dl></li>
			</ul>
		</div>

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree" lay-filter="test">
					<li class="layui-nav-item layui-nav-itemed"><a class=""
						href="javascript:;">文章管理</a>
						<dl class="layui-nav-child">
							<dd id="first_page">
								<a href="javascript:;" lay-href="/articlemg/articlelist">我的文章</a>
							</dd>
							<dd>
								<a href="javascript:;" lay-href="/articlemg/articlelist">标签管理</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item" id="mg_area" style="display: none;"><a href="javascript:;">管理员窗口</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="javascript:;"  lay-href="/adminuserop/super_user_list">用户管理</a>
							</dd>
							<dd>
								<a href="javascript:;" lay-href="/articlemg/super_article_list">文章管理</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="">demo</a></li>
				</ul>
			</div>
		</div>

		<div id="main_container" class="layui-body">
			<span class="layui-breadcrumb"> <a href="">文章管理1</a> <a><cite>文章列表2</cite></a>
			</span>
		</div>

	</div>

<script>
		//JavaScript代码区域

		//var csrf_token = "{{ csrf_token }}"

		var nowtabpage = "/articlemg/articlelist";

		layui.use([ 'jquery', 'form', 'element','layer'], function() {
			var element = layui.element;
			var layer = layui.layer;
			var $ = layui.$;
			var userinfo;
			
			//获取用户信息
			$.ajax({
				url : "/adminuserop/getuserinfo_action",
				method : "GET",
				success : function(res) {
					userinfo=res;
					$("#username").text(res.username);
					if(res.issuper==1){
						$("#mg_area").css("display","block");
					}
				},
				error : function(res) {
					layer.msg("加载用户信息失败！");
				}
			});
			
			$("a").click(function(event) {

				if ($(this).attr('lay-href') == undefined) {
					console.log("没有链接地址")
					return;
				} else {
					$.ajax({
						url : $(this).attr('lay-href'),
						method : "GET",
						success : function(res) {
							nowtabpage = $(this).attr('lay-href')
							//if (res.result == 'ok') {
							$("#main_container").html($(res))

							element.render('breadcrumb');
							//}
						},
						error : function(res) {

						}
					})
					return;
				}
			})
			
			$("#first_page").addClass("layui-this");
			$("dd.layui-this>a").click();

		});
	</script>
</body>
</html>